package com.zhou.core.logana.repository;

import com.zhou.core.logana.repository.redis.DefaultRedisLogAnaRepository;

/**
 * Created by zhouyongjun on 2020/7/3
 */
public final class LogAnaRepositoryFactory {
    static  LogAnaRepositoryFactory instance = new LogAnaRepositoryFactory();
    private LogAnaRepositoryFactory(){}
    public static LogAnaRepositoryFactory getInstance() {
        return instance;
    }

    public ILogAnaRepository createRepository(ILogAnaRepository.LogAnaRepositoryType type) throws Exception {
        ILogAnaRepository repository = null;
        if (type == null) return null;
        switch (type)
        {
            case REDIS:
            {
                repository = new DefaultRedisLogAnaRepository();
                break;
            }
            case HTTP:
            {
                break;
            }
            case MYSQL:
            {
                throw new Exception("Not support Mysql Repository!!!");
            }

        }
        return repository;
    }
}
